package gogogo.liwushuo.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

/**
 * Created by cong on 2016/7/20.
 */
public class CategoryVpAdapter extends FragmentPagerAdapter {

    private String[] title = {"攻略", "单品"};
    private List<Fragment> mList;

    public CategoryVpAdapter(FragmentManager fm, List<Fragment> list) {
        super(fm);
        mList = list;
    }

    @Override
    public Fragment getItem(int position) {
        return mList.get(position);
    }

    @Override
    public int getCount() {
        return mList == null ? 0 : mList.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return title[position];
    }
}
